motorcycles=['honda','yamaha','suzuki']
print(motorcycles)
motorcycles[0]='ducati'
print(motorcycles)

#在列表末尾添加元素
motorcycles=['honda','yamaha','suzuki']
motorcycles.append('ducati')
print(motorcycles)
motorcycles=[]
motorcycles.append('honda')
motorcycles.append('yamada')
motorcycles.append('suzuki')
print(motorcycles)

#在列表中插入元素
motorcycles=['honda','yamaha','suzuki']
motorcycles.insert(1,'ducati')
print(motorcycles)

#使用del语句删除元素
motorcycles=['honda','yamaha','suzuki']
del motorcycles[0]
print(motorcycles)
del motorcycles[0]
print(motorcycles)
#del motorcycles[2] 元素全删了后，再print列表会出来[]

#使用pop（）方法删除元素
motorcycles=['honda','yamaha','suzuki']
print(motorcycles)
popped_motorcycles=motorcycles.pop()
print(motorcycles)
print(popped_motorcycles)
motorcycles=['honda','yamaha','suzuki']
last_owned=motorcycles.pop()
print(f'The last motorcycle I owned was a {last_owned.title()}.')#此处用单引号也行，不影响运行结果

#弹出列表中任意位置处的元素
motorcycles=["honda","yamaha","suzuki"]#列表中的元素即使用双引号，最后打印的时候依旧是单引号,且完全不影响在print中的使用
first_owned=motorcycles.pop(0)
print(f"The first motorcycles I owned was  a {first_owned.title()}")

#根据值删除元素
motorcycles=['honda','yamaha','suzuki','ducati']
print(motorcycles)
too_expensive='ducati'
motorcycles.remove(too_expensive)
print(motorcycles)
print(f'\nA {too_expensive.title()} is too expensive for me')